package com.carryduck.util.page;

public class Page {
	private Integer page = 1;
	private Integer pageSize = 10; //每页记录数
	private Integer pages ;//当前页
	private Integer pageCount;	//总记录数
	private Integer totalpage;	//总页数
	private Integer perPage;	//上一页
	private Integer nextPage;	//下一页


	public Integer getPageCount() {
		return pageCount;
	}
	public void setPageCount(Integer pageCount) {
		this.pageCount = pageCount;
		totalpage = pageCount % pageSize == 0 ? pageCount / pageSize : pageCount / pageSize +1;
		perPage = page - 1 <= 1 ? 1:page - 1;
		nextPage = page + 1 >= totalpage ? totalpage : page+1;
	}
	public Integer getTotalpage() {
		return totalpage;
	}
	public void setTotalpage(Integer totalpage) {
		this.totalpage = totalpage;
	}
	public Integer getPerPage() {
		return perPage;
	}
	public void setPerPage(Integer perPage) {
		this.perPage = perPage;
	}
	public Integer getNextPage() {
		return nextPage;
	}
	public void setNextPage(Integer nextPage) {
		this.nextPage = nextPage;
	}
	public Integer getPage() {
		return page;
	}
	public void setPage(Integer page) {
		this.page = page;
		this.pages = (page - 1) * pageSize;
	}
	public Integer getPageSize() {
		return pageSize;
	}
	public void setPageSize(Integer pageSize) {
		this.pages = (page - 1) * pageSize;
		this.pageSize = pageSize;
	}
	public Integer getPages() {
		return pages;
	}
	public void setPages(Integer pages) {
		this.pages = pages;
	}
	public Page() {
		super();
		this.pages = (page - 1) * pageSize;
	}
	public Page(Integer page, Integer pageSize) {
		super();
		this.pageSize=pageSize;
		this.page = page;
		this.pages = (page - 1) * pageSize;
	}

	public Page(Integer page, Integer pageSize, Integer pageCount) {
		super();
		this.setPage(page);
		this.setPageSize(pageSize);
		this.setPageCount(pageCount);
	}

}
